package com.foreknow.proxy.cglibproxy;

import org.springframework.cglib.proxy.Enhancer;

public class TestCglib {
    public static void main(String[] args) {
        //创建一个cglib的增强对象
        Enhancer enhancer = new Enhancer();
        //设置被代理类
        enhancer.setSuperclass(SuperMarketImpl.class);
        //设置代理方法的拦截器
        enhancer.setCallback(new MethodHandler());
        //创建代理对象
        SuperMarketAction superMarketAction = (SuperMarketAction) enhancer.create();
        superMarketAction.deliver();
    }
}
